import logging
import sqlite3

logger = logging.getLogger(__name__)


def execute_sql(db_path: str, dcl_sql_path: str):
    try:
        with sqlite3.connect(db_path) as conn:
            with open(dcl_sql_path, "r", encoding="utf-8") as f:
                sql = f.read()
                conn.executescript(sql)
    except Exception as e:
        logger.error(f"SQL execution failed: {e}")
        raise
    logger.info("SQL executed.")
